package com.daoxuehao.baseframework.model;

import com.daoxuehao.baseframework.model.api.ApiManager;
import com.daoxuehao.baseframework.model.beans.IpInfo;
import com.daoxuehao.baseframework.module.main.presenter.IMainPresenter;

import rx.Subscriber;

/**
 * Created by Yale on 2016/3/28.
 */
public class MainModel {

    IMainPresenter mIMainPresenter;

    public MainModel(IMainPresenter iMainPresenter) {
        this.mIMainPresenter = iMainPresenter;
    }

    public void loadData() {

        ApiManager.getInstance().getIpInfo(new Subscriber<IpInfo>() {
            @Override
            public void onCompleted() {
            }
            @Override
            public void onError(Throwable e) {
                mIMainPresenter.loadDataFailure();
            }
            @Override
            public void onNext(IpInfo ipInfo) {
                mIMainPresenter.loadDataSuccess(ipInfo);
            }
        },"63.223.108.42");

    }
}
